// File: /workspace/github_cpp_makefile_star2_O1/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 0x2d3d(%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 0x994a
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 0x2d6d(%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 0x9816
callq 0x3260
leaq 0x2d80(%rip), %rsi      # 0xc59d
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x20(%rbx)
leaq 0x2d6c(%rip), %rsi      # 0xc5a4
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x24(%rbx)
leaq 0x2b81(%rip), %rsi      # 0xc3d4
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x28(%rbx)
leaq 0x2b6b(%rip), %rsi      # 0xc3d9
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x2c(%rbx)
leaq 0x2d02(%rip), %rsi      # 0xc58b
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x30(%rbx)
leaq 0x2cf0(%rip), %rsi      # 0xc594
leaq -0x48(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x33f0
movl %eax, 0x34(%rbx)
leaq 0x2cf1(%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 0x9901
callq 0x3260
leaq -0xf0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9916
callq 0x3260
leaq -0x150(%rbp), %rdi
callq 0xa850
leaq -0x1a0(%rbp), %rdi
callq 0xa9de
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 0x567f(%rip), %rdi      # 0xefd0
leaq 0x2bd3(%rip), %rsi      # 0xc52b
movl $0x1c, %edx
callq 0x32f0
movq 0x5667(%rip), %rdi      # 0xefd0
callq 0x3130
movq %rax, %rbx
leaq 0x2b69(%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 0x9a04
callq 0x3260
jmp 0x9a04
jmp 0x99e6
movq %rax, %r14
jmp 0x9a10
movq %rax, %r14
jmp 0x9a1c
jmp 0x99e6
jmp 0x99eb
movq %rax, %r14
jmp 0x9a04
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x99fb
callq 0x3260
leaq -0x48(%rbp), %rdi
callq 0x3140
leaq -0x3a8(%rbp), %rdi
callq 0x3080
leaq -0x1a0(%rbp), %rdi
callq 0xa800
leaq -0x70(%rbp), %rdi
callq 0x3140
movq %r14, %rdi
callq 0x34d0