// File: /workspace/github_cpp_makefile_star2_O3/Agusyc[P]CTRPG/src/jsonparser.cpp
// Function: parseAttack(int)
Attack parseAttack(int index) {
    Json::Value root; // The root element
    Json::Reader reader; // The reader... that reads

    ifstream ifs("./json/attacks.json");

    bool parsingSuccessful = reader.parse(ifs, root);
    if (!parsingSuccessful) {
        // Print error
        cout << "Failed to parse the attacks." << endl << "Error:" << endl << reader.getFormattedErrorMessages();
        exit(1);
    }

    Json::Value jAttack = root[index];

    Attack attack;

    attack.name = jAttack["name"].asString();
    attack.damage = jAttack["damage"].asInt();
    attack.magicDamage = jAttack["magicDamage"].asInt();
    attack.mana = jAttack["mana"].asInt();
    attack.stamina = jAttack["stamina"].asInt();
    attack.minLevel = jAttack["minLevel"].asInt();
    attack.maxLevel = jAttack["maxLevel"].asInt();
    attack.cost = jAttack["cost"].asInt();
    attack.id = index;

    return attack;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x390, %rsp            # imm = 0x390
movl %esi, %r14d
movq %rdi, %rbx
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x3100
leaq -0x1a0(%rbp), %rdi
callq 0x32a0
leaq 0x2d8d(%rip), %rsi      # 0xc4b1
leaq -0x3a8(%rbp), %rdi
movl $0x8, %edx
callq 0x34f0
leaq -0x1a0(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movl $0x1, %ecx
callq 0x3510
testb %al, %al
je 0x98fa
leaq -0x70(%rbp), %rdi
movl %r14d, %esi
callq 0x32c0
leaq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x3450
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq 0x2dbd(%rip), %rsi      # 0xc548
leaq -0x48(%rbp), %rdi
callq 0x30e0
leaq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x3500
leaq -0x90(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3330
movq (%r15), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x97c6
callq 0x3260
leaq 0x2dd0(%rip), %rsi      # 0xc59d
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x20(%rbx)
leaq 0x2dbc(%rip), %rsi      # 0xc5a4
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x24(%rbx)
leaq 0x2bd1(%rip), %rsi      # 0xc3d4
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x28(%rbx)
leaq 0x2bbb(%rip), %rsi      # 0xc3d9
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x2c(%rbx)
leaq 0x2d52(%rip), %rsi      # 0xc58b
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x30(%rbx)
leaq 0x2d40(%rip), %rsi      # 0xc594
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x34(%rbx)
leaq 0x2d41(%rip), %rsi      # 0xc5b0
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x38(%rbx)
movl %r14d, 0x3c(%rbx)
leaq -0x48(%rbp), %rdi
callq 0x3140
leaq -0x3a8(%rbp), %rdi
callq 0x3080
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x98b1
callq 0x3260
leaq -0xf0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x98c6
callq 0x3260
leaq -0x150(%rbp), %rdi
callq 0xa800
leaq -0x1a0(%rbp), %rdi
callq 0xa9a0
leaq -0x70(%rbp), %rdi
callq 0x3140
movq %rbx, %rax
addq $0x390, %rsp            # imm = 0x390
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x56cf(%rip), %rdi      # 0xefd0
leaq 0x2c23(%rip), %rsi      # 0xc52b
movl $0x1c, %edx
callq 0x32f0
movq 0x56b7(%rip), %rdi      # 0xefd0
callq 0x3130
movq %rax, %rbx
leaq 0x2bb9(%rip), %rsi      # 0xc4e1
movl $0x6, %edx
movq %rax, %rdi
callq 0x32f0
movq %rbx, %rdi
callq 0x3130
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x3420
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x3230
leaq -0x48(%rbp), %rdi
callq 0x3120
movl $0x1, %edi
callq 0x3320
movq %rax, %r14
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99b4
callq 0x3260
jmp 0x99b4
jmp 0x9996
movq %rax, %r14
jmp 0x99c0
movq %rax, %r14
jmp 0x99cc
jmp 0x9996
jmp 0x999b
movq %rax, %r14
jmp 0x99b4
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x99ab
callq 0x3260
leaq -0x48(%rbp), %rdi
callq 0x3140
leaq -0x3a8(%rbp), %rdi
callq 0x3080
leaq -0x1a0(%rbp), %rdi
callq 0xa7b0
leaq -0x70(%rbp), %rdi
callq 0x3140
movq %r14, %rdi
callq 0x34d0